<?php
namespace app\admin\controller;

use app\common\controller\CommonController;
use app\common\service\AuthService;
use think\Db;

class Index extends CommonController
{
    public function index()
    {
        $this->title = '系统管理后台';

        $this->menus = AuthService::getAuthMenu();

        if (empty($this->menus) && !session('user.id')) {
            $this->redirect('@admin/login');
        } else {
            $this->assign('menus',$this->menus);
            return $this->fetch();
        }
    }
    /**
     * 后台环境信息
     * @return mixed
     */
    public function main()
    {
        $this->think_ver = \think\App::VERSION;
        $this->mysql_ver = Db::query('select version() as ver')[0]['ver'];
        $this->assign('think_ver',$this->think_ver);
        $this->assign('mysql_ver',$this->mysql_ver);
        return $this->fetch();
    }


}
